package com.whh.service.role;

import com.whh.dao.role.RoleDao;
import com.whh.dao.role.RoleDaoImpl;
import com.whh.pojo.Role;
import com.whh.util.BaseUtils;


import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class RoleServiceImpl implements RoleService {
    //调用dao层
    private RoleDao roleDao=new RoleDaoImpl();
    public RoleServiceImpl() {
        roleDao=new RoleDaoImpl();
    }


    @Override
    public List<Role> getRoleList() {
        Connection conn=null;
        List<Role> roleList=null;

        try {
            conn= BaseUtils.getConnection();
           roleList = roleDao.getRoleList(conn);

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            BaseUtils.closeResource(conn,null,null);
        }

        return roleList;
    }

}
